<%@page import="java.util.ArrayList"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="connection.UsersDAO"%>
<%@ page import="shopping.Users"%>
<%@ page import="shopping.Operate"%>

<%
	String username = "";
	String password = "";
	request.setCharacterEncoding("utf-8");

	username = request.getParameter("username");
	password = request.getParameter("password");
	
	UsersDAO userdao=new UsersDAO();
	if(userdao.getUser(username)==null){
		response.sendRedirect("loginfail.jsp");
	}
	else{
		Users user=userdao.getUser(username);
		if (user.getPassword().equals(password)) {
			request.getRequestDispatcher("display.jsp").forward(request,
					response);

		} else {
			response.sendRedirect("loginfail.jsp");
		}
	}
%>


